LIBA=${GRASP}/lib/librang90.a
MODULES_INSTALL=${GRASP}/lib/rang90
FC_MODULES= -I ${GRASP}/src/lib/libmod -I ${GRASP}/src/lib/lib9290 -I ${GRASP}/src/lib/libmcp90

OBJS= \
	Gracah1.o \
	Gracah1_I.o \
	jthn.o \
	jthn_I.o \
	rumtjj.o \
	rumtjj_I.o \
	ittk.o \
	ittk_I.o \
	c0t5s.o \
	c0t5s_I.o \
	Rmeajj11.o \
	Rmeajj11_I.o \
	Rmeajj9.o \
	Rmeajj9_I.o \
	Rmew1jj.o \
	Rmew1jj_I.o \
	Rmew3jj.o \
	Rmew3jj_I.o \
	Rmew5jj.o \
	Rmew5jj_I.o \
	Rmew7bjj.o \
	Rmew7bjj_I.o \
	Rmew7jj.o \
	Rmew7jj_I.o \
	Rmeajj.o \
	Rmeajj_I.o \
	Rwjj.o \
	Rwjj_I.o \
	a1jj.o \
	a1jj_I.o \
	mes.o \
	mes_I.o \
	itjj.o \
	itjj_I.o \
	itjj2.o \
	itjj2_I.o \
	itjj3.o \
	itjj3_I.o \
	ixjtik.o \
	ixjtik_I.o \
	itrexg.o \
	itrexg_I.o \
	izas1.o \
	izas1_I.o \
	jfaze.o \
	jfaze_I.o \
	sixj1.o \
	sixj1_I.o \
	sixj2.o \
	sixj2_I.o \
	sixj3.o \
	sixj3_I.o \
	sixj35.o \
	sixj35_I.o \
	dracah.o \
	dracah_I.o \
	sixj4.o \
	sixj4_I.o \
	sixj5.o \
	sixj5_I.o \
	sixj.o \
	sixj_I.o \
	awp1.o \
	awp1_I.o \
	w1jjg.o \
	w1jjg_I.o \
	wap1jjg.o \
	wap1jjg_I.o \
	c1e0sm.o \
	c1e0sm_I.o \
	c1e1sm.o \
	c1e1sm_I.o \
	cle0sm.o \
	cle0sm_I.o \
	wj1.o \
	wj1_I.o \
	ww1.o \
	ww1_I.o \
	wap1.o \
	wap1_I.o \
	awp1jjg.o \
	awp1jjg_I.o \
	coulom.o \
	coulom_I.o \
	nine0.o \
	nine0_I.o \
	nine.o \
	nine_I.o \
	diaga1.o \
	diaga1_I.o \
	diaga2.o \
	diaga2_I.o \
	diaga3.o \
	diaga3_I.o \
	diaga4.o \
	diaga4_I.o \
	diaga5.o \
	diaga5_I.o \
	eile.o \
	eile_I.o \
	reco2.o \
	reco2_I.o \
	reco3.o \
	reco3_I.o \
	reco4.o \
	reco4_I.o \
	reco.o \
	reco_I.o \
	rec3.o \
	rec3_I.o \
	nmtejj.o \
	nmtejj_I.o \
	perko1.o \
	perko1_I.o \
	perko2.o \
	perko2_I.o \
	snrc.o \
	snrc_I.o \
	gg1112.o \
	gg1112_I.o \
	gg1122.o \
	gg1122_I.o \
	gg12.o \
	gg12_I.o \
	gg1222.o \
	gg1222_I.o \
	gg1233.o \
	gg1233_I.o \
	gg1234.o \
	gg1234_I.o \
	el1.o \
	el1_I.o \
	el2.o \
	el2_I.o \
	el31.o \
	el31_I.o \
	el32.o \
	el32_I.o \
	el33.o \
	el33_I.o \
	el3.o \
	el3_I.o \
	el41.o \
	el41_I.o \
	el4.o \
	el4_I.o \
	el51.o \
	el51_I.o \
	el52.o \
	el52_I.o \
	el53.o \
	el53_I.o \
	el5.o \
	el5_I.o \
	recop1.o \
	recop1_I.o \
	recop2.o \
	recop2_I.o \
	recop00.o \
	recop00_I.o \
	oneparticlejj1.o \
	oneparticlejj1_I.o \
	oneparticlejj2.o \
	oneparticlejj2_I.o \
	oneparticlejj.o \
	oneparticlejj_I.o \
	recoonescalar.o \
	recoonescalar_I.o \
	onescalar1.o \
	onescalar1_I.o \
	onescalar2.o \
	onescalar2_I.o \
	onescalar.o \
	onescalar_I.o \
	rkco_gg.o \
	rkco_gg_I.o \
	suwjj.o \
	suwjj_I.o

PHONY: install
install: $(LIBA)
	mkdir -p $(MODULES_INSTALL)
	cp -v *.mod $(MODULES_INSTALL)

$(LIBA): $(OBJS)
	@echo "Installing $@"
	ar -curs $@ $?

%.o: %.f90
	$(FC) -c $(FC_FLAGS) $(FC_MODULES) -o $@ $<

clean:
	-@rm $(LIBA)
	-@rm *.o *.mod
	-@rm -R $(MODULES_INSTALL)
